<?php

$data = array('msg' => null, 'type' => 'hardware', 'table' => 'hardware');

$data['union'][0]['table'] = &$data['table'];

$data['union'][0]['joins'] = array(
  'models',
  'categories',
  'conditions',
  'locations',
  'departments',
  'buildings'
);

$data['union'][0]['join_fields'] = array(
  '`model_id`=`models`.`id`',
  '`condition_id`=`conditions`.`id`',
  '`category_id`=`categories`.`id`',
  '`location_id`=`locations`.`id`',
  '`department_id`=`departments`.`id`',
  '`building_id`=`buildings`.`id`'
);

$data['union'][0]['where'] = array(
  'loc' => 'location_id IS NOT NULL'
);

$data['union'][1]['table'] = &$data['table'];

$data['union'][1]['joins'] = array(
  'models',
  'categories',
  'conditions',
  'locations',
  'cpus',
  'departments',
  'buildings'
);

$data['union'][1]['join_fields'] = array(
  '`model_id`=`models`.`id`',
  '`condition_id`=`conditions`.`id`',
  '`category_id`=`categories`.`id`',
  '`cpu_location_id`=`locations`.`id`',
  '`cpu_id`=`cpus`.`id`',
  '`department_id`=`departments`.`id`',
  '`building_id`=`buildings`.`id`'
);

$data['union'][1]['where'] = array(
  'loc' => 'location_id IS NULL'
);

?>
